<?php

/**
 * Partner form base class.
 *
 * @method Partner getObject() Returns the current form's model object
 *
 * @package    billingSystem
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePartnerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'pid'        => new sfWidgetFormInputHidden(),
      'fname'      => new sfWidgetFormInputText(),
      'lname'      => new sfWidgetFormInputText(),
      'phone'      => new sfWidgetFormInputText(),
      'zip'        => new sfWidgetFormInputText(),
      'distype'    => new sfWidgetFormChoice(array('choices' => array('Fixed' => 'Fixed', 'Percentage' => 'Percentage'))),
      'disvalue'   => new sfWidgetFormInputText(),
      'billfreq'   => new sfWidgetFormChoice(array('choices' => array('daily' => 'daily', 'weekly' => 'weekly', 'monthly' => 'monthly'))),
      'invrecfreq' => new sfWidgetFormChoice(array('choices' => array('daily' => 'daily', 'weekly' => 'weekly', 'monthly' => 'monthly'))),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'pid'        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('pid')), 'empty_value' => $this->getObject()->get('pid'), 'required' => false)),
      'fname'      => new sfValidatorString(array('max_length' => 250)),
      'lname'      => new sfValidatorString(array('max_length' => 250)),
      'phone'      => new sfValidatorString(array('max_length' => 220)),
      'zip'        => new sfValidatorString(array('max_length' => 220)),
      'distype'    => new sfValidatorChoice(array('choices' => array(0 => 'Fixed', 1 => 'Percentage'))),
      'disvalue'   => new sfValidatorNumber(),
      'billfreq'   => new sfValidatorChoice(array('choices' => array(0 => 'daily', 1 => 'weekly', 2 => 'monthly'))),
      'invrecfreq' => new sfValidatorChoice(array('choices' => array(0 => 'daily', 1 => 'weekly', 2 => 'monthly'))),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('partner[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Partner';
  }

}
